package oop.ex2.commands;

import oop.ex2.expression.ExpressionSolver;

/**
 * This subclass implements the assignment operation:
 * var = var - expression
 * @author daniel_i_l
 *
 */
public class MinusAssignmentOp extends AssignmentOpCommand {
	static final String ASSIGNMENT_OP = "-=";
	
	/**
	 * Build an assignment operation command using a given expression solver and assignment
	 * operation string.
	 * @param expressionSolver The expression solver to use.
	 * @param assignmentOp The assignment operation string to look for.
	 */
	public MinusAssignmentOp(ExpressionSolver expressionSolver) {
		super(expressionSolver, ASSIGNMENT_OP);
	}

	@Override
	public double preassignmentOperation(double varVal, double expVal) {
		return varVal - expVal;
	}

}
